package stage.dao.impl;

import java.util.*;

import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

import stage.dao.HistoricalInfosDAO;
import stage.pojo.HistoricalInfo;
/**
 * multi historical info DAO implement. 
 * @author remi liu(Liu Zhibin)
 * @version 0.0
 */
public class HistoricalInfosDAOImpl implements HistoricalInfosDAO{

	public List get(Session s,Character hospital,Character department,Boolean isExpert,Integer weekday){
		Map<String,Object> m=new HashMap<String,Object>();
		m.put("hospital", hospital);
		m.put("department", department);
		m.put("isExpert", isExpert);
		m.put("weekday", weekday);
		List l=s.createCriteria(HistoricalInfo.class).add(Restrictions.allEq(m)).list();
		if(l.size()==0)return null;
		return l;
	}
		
	public List getAll(Session s,Character hospital,Character department,Boolean isExpert){
		Map<String,Object> m=new HashMap<String,Object>();
		m.put("hospital", hospital);
		m.put("department", department);
		m.put("isExpert", isExpert);
		List l=s.createCriteria(HistoricalInfo.class).add(Restrictions.allEq(m)).list();
		if(l.size()==0)return null;
		return l;
		}

}
